<!--  -->
<template>
  <div>
    <div v-for="(item,index) in list" :key="index + 'ss'" style="margin-bottom:20px">
      <div style="margin-bottom:20px">
        {{item.title}}检测项目表明细
      </div>
      <tableData :table-head="item.place_conditions_infos"
      :stability="stability"
        :table-list="tableTitle.stability_sample_info" :table-data="data[item.id]" />
    </div>
  </div>
</template>

<script>
export default {
  components: {
    tableData: () => import("./tableData.vue")
  },
  props: {
    tableTitle: {
      type: Object,
      default: function() {
        return {
          stability_sample_info: {},
          inspect_types: []
        };
      }
    },
    data: {
      type: Object,
      default: function() {
        return {};
      }
    },
    stability:{
      type: Number,
      default: function() {
        return 0;
      }
    }
  },
  data() {
    return {
      sample_name: "",
      inspect_type_name: "",
      list: []
    };
  },
  //是计算属性，也可以理解为一个方法。
  computed: {},
  //属性是手动定义的所需监听的值
  watch: {},
  //生命周期 - 创建完成（访问当前this实例）
  created() {},
  //生命周期 - 挂载完成（访问DOM元素）
  mounted() {
    let title;
    this.tableTitle.inspect_types.forEach(element => {
      element.title =
        this.tableTitle.stability_sample_info.sample_name +
        element.inspect_type.inspect_type_name;
      element.id =
        this.tableTitle.stability_sample_info.id + '?' + element.inspect_type.id;
      if (!this.data[element.id]) {
        let data = {
          tableData: [],
          combined: {},
          total: {},
          typeId:element.inspect_type.id,
          title:this.tableTitle.stability_sample_info.sample_name,
          ides:element.inspect_type.id,
          typeName:element.inspect_type.inspect_type_name
        };
        this.data[element.id] = data;
      }
    });
    this.list = this.tableTitle.inspect_types;
    this.$emit("handlData",this.list);
  },
  //是Vue实例对象上绑定的方法，供当前Vue组件作用域内使用，
  methods: {}
};
</script>
<style scoped>
/* @import url(); 引入css类 */
</style>
